/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Credits.java
 *
 * Created on Nov 4, 2009, 10:14:11 PM
 */
package gui;

import java.awt.Color;
import java.awt.Font;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
import javax.imageio.ImageIO;
import javax.swing.BorderFactory;

/**
 *
 * @author gabriel
 */
public class Credits extends javax.swing.JPanel {

    public static BufferedImage logo = null;
    public Color orange = new Color(238, 182, 35);
    public Color maroon = new Color(136, 58, 58);
    Paint gradient = new GradientPaint(0, 0, orange, 0, 500, maroon);

    /** Creates new form Credits */
    public Credits() {
        initComponents();
        this.setBorder(BorderFactory.createEtchedBorder());
        final String ABS_RESOURCE_LOCATION = "aasu.png";
        InputStream is = getClass().getResourceAsStream(ABS_RESOURCE_LOCATION);
        try {
            Credits.logo = (BufferedImage) ImageIO.read(is);
        } catch (IOException ex) {
        }
        repaint();
    }

    @Override
    public void paintComponent(Graphics graphics) {

        super.paintComponent(graphics);
        Graphics2D g = (Graphics2D) graphics;
        g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                RenderingHints.VALUE_ANTIALIAS_ON);
        g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
                RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
        g.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING,
                RenderingHints.VALUE_COLOR_RENDER_QUALITY);
        g.clearRect(0, 0, getWidth(), getHeight());

        gradient = new GradientPaint(0, 0, orange, 0, getHeight() - (getHeight() / 3), maroon);
        g.setPaint(gradient);
        g.fill(new Rectangle(0, 0, getWidth(), getHeight()));

        int y = logo.getHeight() + 20;

        g.drawImage(logo, null, getWidth() / 2 - logo.getWidth() / 2, 10);

        g.setColor(Color.BLACK);

        g.setFont(new Font("Arial", Font.BOLD | Font.ITALIC, 50));
        g.drawString("Authors:",
                getWidth() / 2 - g.getFontMetrics().stringWidth("Authors:") / 2,
                g.getFontMetrics().getHeight() + y + 10);
        y += g.getFontMetrics().getHeight() + 10;
        g.setFont(new Font("Arial", Font.PLAIN, 30));
        g.drawString("Gabriel Loewen",
                getWidth() / 2 - g.getFontMetrics().stringWidth("Gabriel Loewen") / 2,
                g.getFontMetrics().getHeight() + y + 10);
        y += g.getFontMetrics().getHeight() + 10;
        g.drawString("James Weston",
                getWidth() / 2 - g.getFontMetrics().stringWidth("James Weston") / 2,
                g.getFontMetrics().getHeight() + y + 10);
        y += g.getFontMetrics().getHeight() + 10;
        g.drawString("Jackie O'Quinn",
                getWidth() / 2 - g.getFontMetrics().stringWidth("Jackie O'Quinn") / 2,
                g.getFontMetrics().getHeight() + y + 10);
        y += g.getFontMetrics().getHeight() + 20;
        g.setFont(new Font("Arial", Font.BOLD | Font.ITALIC, 50));
        g.drawString("Advisors:",
                getWidth() / 2 - g.getFontMetrics().stringWidth("Advisors:") / 2,
                g.getFontMetrics().getHeight() + y + 10);
        y += g.getFontMetrics().getHeight() + 10;
        g.setFont(new Font("Arial", Font.PLAIN, 30));
        g.drawString("Dr. Ashraf Saad",
                getWidth() / 2 - g.getFontMetrics().stringWidth("Dr. Ashraf Saad") / 2,
                g.getFontMetrics().getHeight() + y + 10);
        y += g.getFontMetrics().getHeight() + 10;
        g.drawString("Dr. Bradley Sturz",
                getWidth() / 2 - g.getFontMetrics().stringWidth("Dr. Bradley Sturz") / 2,
                g.getFontMetrics().getHeight() + y + 10);
        y += g.getFontMetrics().getHeight() + 10;

    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        setPreferredSize(new java.awt.Dimension(300, 300));

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 300, Short.MAX_VALUE)
        );
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables
}
